/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 26727
 * Date: 2024-06-14
 * Time: 19:00
 */
public class Test {
    public static void main(String[] args) throws InterruptedException {
        final Object object = new Object();

        // 创建线程t1
        Thread t1 = new Thread(() -> {
            synchronized (object) {
                try {
                    object.wait();
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }, "t1");

        // 启动t1
        t1.start();

        // 创建线程t2
        Thread t2 = new Thread(() -> {
            synchronized (object) {
                System.out.println("xixi");
            }
        }, "t2");

        //启动t2
        t2.start();
    }
}
